<?php
session_start();
?>

<!-- Including file to get the status of CR in string -->
<?php include('./classes/statusOfCr.php'); ?>
<?php 
require_once('KLogger.php');
$log = new KLogger ( "log.txt" , KLogger::DEBUG );
?>

<?php
$username = $_SESSION['username'];
$fullname = $_SESSION['fullname'];
$role = $_SESSION['role'];
if($username==null || $username== ""|| $username == "")
{
	header('Location: http://172.26.195.159/checklist/php/logout.php');
}
?>

<html>

<head>

<title>
CRs in the bin
</title>



<body bgcolor="#C9C299">

<a href="welcome.php"> Home</a>
&nbsp;
<a href="logout.php"> Logout</a>
<!-- Adding code -->

<?php
//creating a connection.
$con = mysql_connect("localhost","root","");
mysql_select_db("checklist", $con);

//check for the CR ID with the person logged in.
$check = "select id from cr_status where  checklist_reviewer = '$username' && status = 1 UNION
          select id from cr_status where internal_idce_reviewer = '$username'&& status = 3 UNION 
		  select id from cr_status where external_idce_reviewer = '$username' && status = 5 UNION 
		  select id from cr_status where pl = '$username' && status = 7 UNION
		  select id from cr_status where dp_prime = '$username' && status = 9 ";
		  

$result = mysql_query($check);
$count = mysql_num_rows($result);

$log->logInfo("Count of database result inside verifyChecklist :".$count);
if($count == 0)
{
echo "</br></br><center><b>No CR to be verified.</b></center></br>";
}
else
$num_rows = mysql_num_rows($result);

?>

<form action="processVerifyChecklist.php" method="post">

<center>
<select name="select_cr" id="select_cr" size=10>
<?php
for($j=0;$j<$num_rows; $j++)
	{
	mysql_data_seek($result , $j);
	$data = mysql_fetch_assoc($result);
	$temp_id = $data['id'];
	
	$s = "select status from cr_status where id = '$temp_id' ";
	
	$resource = mysql_query($s);
	$data_status =  mysql_fetch_assoc($resource);
?>

<option value="<?php echo "".$data['id']?>" > <?php echo "".$data['id'].'('.getStatus($data_status['status']).')' ?> </option> 
<?php
	}

?>
</select>
</center>


<br><br>

<center>
<input type="submit" name="submit" value="Submit" >
</center>

</form>

</body>



</html>